<template>
    <div>
        <button @click="changeCity(item)" v-for="(item,index) of citys" :key="index">{{item}}</button>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                citys:['杭州','上海','深圳']
            }
        },
        methods: {
            changeCity(city){
                localStorage.setItem('city',city)
                this.$store.dispatch('changeCity',city)
                this.$router.push('/')
            }
        }
    }
</script>

<style lang="scss" scoped>

</style>